package cst.a112gxl.laylouttest;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
    private EditText editText;
    private Button button;

    private void init(){
        editText = (EditText) findViewById(R.id.editText3);
        button = (Button) findViewById(R.id.button7);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout4);
        init();
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String msg = editText.getText().toString();
                Toast.makeText(MainActivity.this, "输入的内容是："+msg, Toast.LENGTH_SHORT).show();
            }
        });
    }
}
